using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
using Catastrophe.Common;
using Catastrophe.Common.AttributeEx;
using Catastrophe.Common.FileM;
using Catastrophe.Common.ObjM;
using Catastrophe.CommonCore.FileM;
using SqlSugarEx.Config;

namespace Catastrophe.Log
{
    /// <summary>
    /// 日志配置文件
    /// </summary>
    public class LogConfigIni
    {
        public bool IsRun { get; set; } = true;

        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        /// <exception cref="Exception"></exception>
        [SystemIni(SystemIniTypeEnum.FileConfig, false)]
        public void FileIni()
        {
            try
            {
                var tuple = new FileConfigManager<MyLogConfigEntity>(FileTypeEnum.Json).ReadEntity();
                Ggo<MyLogConfigEntity>.GetObj = tuple;
            }
            catch (Exception innerException)
            {
                throw new Exception("日志模板参数初始化失败", innerException);
            }
        }
    }
}
